package com.hugedata.idc.task;

import org.apache.log4j.Logger;

import com.hugedata.imsp.jabberc.IMSPClient;
import com.hugedata.pd.PD;

public final class SpackClient
{
    private static final Logger LOGGER = Logger.getLogger(SpackClient.class);

    private static IMSPClient IMSP_CLIENT;

    private SpackClient()
    {
    }

    public static IMSPClient getSpackClient()
    {
        if (IMSP_CLIENT == null)
        {
            synchronized (SpackClient.class)
            {
                LOGGER.info("get IMSPClient instance...");
                IMSP_CLIENT = IMSPClient.getInstance();
                LOGGER.info("got IMSPClient.");
            }
        }
        return IMSP_CLIENT;
    }

    /**
     * 
     * @Title: isMCSConnected
     * @Description: 判断MCS连接是否成功
     * @author Wangxiaoming
     */
    public static boolean isMCSConnected()
    {
        boolean isConnectedFlag = false;
        try
        {
            isConnectedFlag = PD.getSingleton().isMCSConnected();
        }
        catch (Exception e)
        {
            LOGGER.error("PD.getSingleton().isMCSConnected() Exception", e);
            isConnectedFlag = false;
        }
        return isConnectedFlag;
    }
}
